// Ajax 1
$(function(){
	$(".ajax option").click(function(){
		if(this.className.match(/vaipra_/)) {
			carregaPagina(this.className.replace("vaipra_",""))
			return false
		} else {
			return true
		}
	})
});
carregaPagina = function(pagina){
	if(pagina != '') {
		location.hash = pagina
		show_loading()
 
		var pagina_sem_hash = pagina.replace("#","")
		$(".conteudo-ajax").load("./"+pagina_sem_hash+".php", function(){
			hide_loading()
		})
		document.body.setAttribute("id", pagina_sem_hash)
	}
};
$(function(){
	if(location.hash != '') {
		carregaPagina(location.hash)
	}
 
	$(".ajax option").click(function(){
		if(this.className.match(/vaipra_/)) {
			carregaPagina(this.className.replace("vaipra_",""))
			return false
		} else {
			return true
		}
	})
});

show_loading = function()
{
	$("#ajax_loader").fadeIn()
	$(".conteudo-ajax").animate({'opacity' : 'hide'}, 'fast')
}

hide_loading = function()
{
	$("#ajax_loader").fadeOut()
	$(".conteudo-ajax").animate({'opacity' : 'show'}, 'slow')
}